<template>
  <div>
    <wapHeader></wapHeader>
    <div class="wapmain">
      <h1>{{$t('vr.mycollection')}}</h1>
      <ul class="infoUl">
        <li v-for="(v,i) in dataList" :key="i" @click="navTo(v)">
          <div class="imgBox" :style="{'background-image': `url(${v.picture})`}"></div>
          <div class="txt">
            {{v.title}}
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import api from "servicePath/index";
import wapHeader from "../common/back.vue";
import { mapState } from "vuex";
export default {
  components: {
    wapHeader
  },
  data() {
    return {
      dataList: []
    };
  },
  computed: {
    ...mapState(["lang"])
  },
  mounted() {
    this.productList();
  },
  methods: {
    navTo (i) {
      if (i.type == '2') {

      } else if (i.type == '1') {
        this.$router.push({
          path: '/foundation/pc/home',
          query: {
            prodId: i.anchor
          }
        })
      }
    },
    async productList() {
      const params = {type:2};
      const res = await api.getProductList(params, this.lang);
      this.dataList = res.data;
      console.log(res);
    }
  }
};
</script>

<style lang="scss" scoped>
.wapmain {
  width: 90%;
  margin: 0 auto;
  h1 {
    font-weight: normal;
    margin: 0 0 20px 0;
  }
  .infoUl {
    width: 100%;
    li {
      background: #fff;
      border-radius: 6px;
      border: none;
      -moz-box-shadow: 1px 1px 14px 5px #f0f0f0;
      -webkit-box-shadow: 1px 1px 14px 5px #f0f0f0;
      box-shadow: 1px 1px 14px 5px #f0f0f0;
      padding: 18px 15px;
      margin-bottom: 15px;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      position: relative;
      .imgBox {
        width: 100px;
        height: 60px;
        background-position: center;
        background-size: cover;
        background-repeat: no-repeat;
        margin-right: 10px;
      }
      .txt {
        width: 65%;
        height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 10px 0;
      }
      .ico {
        width: 40px;
        position: absolute;
        right: 5%;
        top: 33%;
      }
    }
  }
  .btn {
    background: linear-gradient(to right, #ff7f41, #e6007e);
    width: 70%;
    padding: 15px;
    font-size: 14px;
    color: #fff;
    text-align: center;
    border: none;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
  }
}
</style>